package com.jd.onlinequery.common.utils;


import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;


public class ApplicationResourcesUtil {

	private static final String ERROR_NODEFINE_COMMON = "系统异常";
    
	// 异常描述资源文件
	private static final ResourceBundle errmBundle = ResourceBundle.getBundle("ApplicationResources");
	
	public static String getMessageCfg(String errcode, Object[] params) {
		try {
			return params == null ? errmBundle.getString(errcode)
					: MessageFormat.format(errmBundle.getString(errcode),
							params);
		} catch (MissingResourceException e) {
			return errmBundle.getString(ERROR_NODEFINE_COMMON);
		}
	}
	
	public static String getMessageCfg(String errcode) {
		try {
			return errmBundle.getString(errcode);
		} catch (MissingResourceException e) {
			return errmBundle.getString(ERROR_NODEFINE_COMMON);
		}
	}
}
